{literal}
<script id='grid_tpl' type="text/x-jsmart-tmpl">
<div class='grid'>

	<div class='grid-search'>
		<form>
			<input type=text size=50 class="ui-widget-header ui-corner-all" title="Поиск"><span class="ui-icon ui-icon-search"></span>
		</form>
	</div>
	
   {function navigation}
      <div class='navigation'>
         <span class='grid-first' onclick="grid{$id}.go(1)">Первая страница</span>
         <span class='grid-prev'  onclick="grid{$id}.go({$currPage}-1)">Предыдущая страница</span>
         <span class='pageNumbers'>
            {for $page=1 to $pagesCount}
               <span>
                  {if $page == $currPage}
                     <span class='current'>{$page}</span>
                  {else}
                     <a href="#" onclick="grid{$id}.go({$page}); return false;">{$page}</a>
                  {/if}
               </span>
            {/for}
         </span>
         <span class='grid-next' onclick="grid{$id}.go({$currPage+1})">Следующая страница</span>
         <span class='grid-last' onclick="grid{$id}.go({$pagesCount})">Последняя страница</span>
		 <span>На странице:
			<select>
				<option value=20>20</option>
				<option value=50>50</option>
				<option value=100>100</option>
				<option value=200>200</option>
				<option value=500>500</option>
				<option value=1000000000>Все</option>
			</select>
		</span>
		 <span class='total'> 
			{$from} - {$to} / {$count}
		 </span>
      </div>
   {/function}

	{if $records.length}
		{navigation}
	{/if}
   <table width=100%>
		{if $selectableRows}
			<colgroup>
				<col style="width:20px;" />
			</colgroup>
		{/if}
      <thead>
		<tr>
			{if $selectableRows}
				<td><input type=checkbox class='selectAll'/></td>
			{/if}
			{foreach $columns as $col}
				<td title='{$col.hint|default:''}' onclick="grid{$id}.onColClick('{$col.name}')">{$col.title} <span class="{if $sort[$col.name]=='a'}ui-icon ui-icon-triangle-1-n{elseif $sort[$col.name]=='d'}ui-icon ui-icon-triangle-1-s{/if}"></span></td>
			{/foreach}
		</tr>
      </thead>
      <tbody>
         {foreach $records as $rec}
            <tr id='{$rec[0]}' class='{cycle values='even,'}' onmouseover="$(this).addClass('active')" onmouseout="$(this).removeClass('active')">
				{foreach $rec as $field}
					{if !$field@index}
						{if $selectableRows}
							<td class='select'><input type=checkbox value='{$field}'/></td>
						{/if}
					{else}
						<td class='grid-col-{$columns[$field@index-1].type_id}'>
						{if $columns[$field@index-1].type_id == 'image'}
							{if $field}
								<img path='{$field}' />
							{/if}
						{else}
							{$field|default:''|escape:'html'}
						{/if}
						</td>
					{/if}
				{/foreach}
            </tr>
		 {foreachelse}
			<tr><td colspan={$columns.length+$selectableRows}>- Нет данных -</td></tr>
         {/foreach}
      </tbody>
   </table>
	{if $records.length}
		{navigation}   
	{/if}
 </div>
</script>
{/literal}